#define _CRT_SECURE_NO_WARNINGS 1
#include <iostream>
using namespace std;
int main() {
    int a;
    cin >> a;
    int cnt = 0;
    int mx = 0;
    int k = 1;
    int flag = 1;
    if (a < 0)
    {
        flag = -1;
        a = -a;
    }
    while (a)
    {
        if (a & k)
        {
            if (mx == 0)
                mx = 1;
            else
                mx++;
            cnt = max(cnt, mx);
        }
        else
        {
            mx = 0;
        }
        a /= 2;
    }
    cout << cnt << endl;
    return 0;
}